package com.spark.usermusicService.controller;


import com.spark.R;
import com.spark.usermusicService.entity.Songsheet1;
import com.spark.usermusicService.service.PlayService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author wzk
 * @since 2021-06-27
 */
@RestController
@RequestMapping("/usermusicService/play")
@CrossOrigin
public class PlayController {
    @Autowired
    private PlayService playService;

    @GetMapping("findALlUser")
    public R findAll() {

        List<Songsheet1> list = playService.list(null);
        return R.ok().data("items", list);
    }

    @PostMapping("updateInfo")
    public R updateInfo(@RequestBody(required = false) Songsheet1 songsheet1) {

        playService.updateInfo(songsheet1);
        return R.ok();
    }
    @GetMapping("getPublishInfo/{id}")
    public R getPublishInfo(@PathVariable String id){

        Songsheet1 songSheet1 = playService.getInfo(id);
        return R.ok().data("songSheet1",songSheet1);
    }
}
